<?php

namespace app\model;

use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as Capsule;

class BaseModel
{
    public function __construct()
    {
        $database = [
            'driver' => 'mysql',
            'host' => '39.102.44.200',
            'database' => 'sq_web_tp5021',
            'username' => 'book',
            'password' => 'book',
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => 't_',
        ];
        $capsule = new Capsule;
        // 创建链接
        $capsule->addConnection($database, 'default');
        // 设置全局静态可访问
        $capsule->setAsGlobal();
        // 启动Eloquent
        $capsule->bootEloquent();
    }
}